package com.vehicle.exception;

import com.vehicle.enums.StatusCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class VehicleAccessException extends RuntimeException{
    private String defineCode;
    private String message;

    public static final VehicleAccessException DATA_EXIST = new VehicleAccessException(StatusCode.DATA_EXIST);
    public static final VehicleAccessException DATA_NOT_EXIST = new VehicleAccessException(StatusCode.DATA_NOT_EXIST);
    public static final VehicleAccessException DELETE_ERROR = new VehicleAccessException(StatusCode.DELETE_ERROR);
    public static final VehicleAccessException PARAMS_ERROR = new VehicleAccessException(StatusCode.PARAMS_ERROR);
    public static final VehicleAccessException NET_ERROR = new VehicleAccessException(StatusCode.NET_ERROR);
    public static final VehicleAccessException SYSTEM_ERROR = new VehicleAccessException(StatusCode.SYSTEM_ERROR);
    public static final VehicleAccessException IMPL_NOT_EXIST = new VehicleAccessException(StatusCode.IMPL_NOT_EXIST);


    public VehicleAccessException(StatusCode statusCode) {
        this.defineCode = statusCode.getCode();
        this.message = statusCode.getMessage();
    }

    public VehicleAccessException(String defineCode, String message) {
        this.defineCode = defineCode;
        this.message = message;
    }

    public VehicleAccessException newInstance(String message) {
        return new VehicleAccessException(defineCode, message);
    }
}
